var ns, map, app, timer, marqueesHeight, slide, imageBrowser,
    stopscroll, scrollElem, preTop, currentTop, stoptime, leftElem, popup;
app = new Vue({
    el: '#app',
    data: {
        form: {
            status: 1
        },
        list: [{
            ID: 0,
            TypeName: '保洁问题',
            fullname: '永友小区',
            content: '14栋2层楼道没有打扫干净，谁在负责，马上处理',
            endtime: '2020-02-20 11:00',
            ProcessList: [{
                title: '工单办结',
                processtime: '2020-02-20 15:00',
                processname: '张三'
            }],
        }],
        isviewhistory: false,
        total: {
            WaitingCount: 0,
            ProcessCount: 0,
        }
    },
    methods: {
        get_data: function() {
            var that = this;
            var options = {};
            options.status = that.form.status;
            options.action = "getqualitycontrollist";
            ns.post(options, function(succeed, data, err) {
                if (succeed) {
                    that.list = data.list;
                    that.total = data.countform;
                } else if (err) {
                    api.toast({
                        msg: err,
                        duration: 2000,
                        location: 'bottom'
                    });
                }
            }, {
                toast: true
            });
        },
        do_select_tab: function(status) {
            var that = this;
            that.form.status = status;
            that.get_data();
        },
        do_open: function(ID) {
            var that = this;
            ns.openWin('qualitycontroldetail_frm', '工单详情', {
                id: ID,
                isviewhistory: that.isviewhistory
            })
        }
    }
});
apiready = function() {
    api.parseTapmode();
    ns = window.Foresight.Util;
    app.isviewhistory = api.pageParam.isviewhistory || false;
    app.get_data();
    api.addEventListener({
        name: 'reloadservicelist'
    }, function(ret, err) {
        app.get_data();
    });
};
